<style>
  .box a {
    width: 200px;
    display: inline-block;
  }
</style>

<body>
  <div>
    <input class="i1" type="number" style="width: 200px;" placeholder="输入打目录页数">
    <input type="button" value="打开目录" class="btn" onclick="openPage(1)">
  </div>
  <div>
    <input class="i2" type="number" style="width: 200px;" placeholder="输入打开备用设置的页数">
    <input type="button" value="打开备用设置" class="btn" onclick="openPage(2)">
  </div>
  <div>
    <input class="i3" type="number" style="width: 200px;" placeholder="输入打开备用设置的页数">
    <input type="button" value="打开备用设置" class="btn" onclick="openPage(3)">
  </div>
  <input class="begin" type="number" style="width: 200px;" placeholder="开始页面">
</body>
<!-- (div.box>a[href=https://www.yuque.com/__backup__/a$ target="_blank"]{备用a$}a[href=https://www.yuque.com/__backup__/a$/toc target="_blank"]{备用a$设置})*100 -->

<script>
  // 遍历知识库
  Array(500).fill().forEach((item, i) => {
    if (i == 0) {
      let d = document.createElement("div");
      d.innerText = Array(500).fill().length + "个页面"
      document.body.appendChild(d);
      return
    }
    let divBox = document.createElement("div");
    divBox.className = "box";
    let a1 = document.createElement("a");
    let a2 = document.createElement("a");
    let a3 = document.createElement("a");
    a1.target = "_blank"
    a2.target = "_blank"
    a3.target = "_blank"

    a1.innerText = `a${(i).toString()}`
    a1.href = `https://www.yuque.com/kenguba/a${(i)}`


    a2.innerText = `a${i} 设置`
    // a2.href = `https://www.yuque.com/kenguba/a${(i)}/settings/advanced`
    // a2.href = `https://www.yuque.com/kenguba/a${(i)}/toc`
    a2.href = `https://www.yuque.com/kenguba/a${(i)}/settings/basic`


    a3.innerText = `a${i} 文档管理`
    a3.href = `https://www.yuque.com/r/kenguba/a${i}/docs?q=&show_by=&sort_by=&status=notInTOC&type=&user_ids=`

    divBox.appendChild(a1);
    divBox.appendChild(a2);
    divBox.appendChild(a3);
    document.body.appendChild(divBox);
  })

  function openPage(nodeNum = 1) {
    let num = document.querySelector(`.i${nodeNum}`).value || 1;
    let a1 = document.querySelectorAll(`.box a:nth-child(${nodeNum})`)
    if (parseInt(num) > a1.length) return alert("大于节点")
    var begin = document.querySelector(`.begin`).value - 1 || 1;
    for (let i = begin; i < num; i++) {
      setTimeout(() => { a1[i].click() }, 600 * (i - begin + 2));
    }
  }
</script>